home *** CD-ROM | disk | FTP | other *** search
- ;
- ; $VER: Install_UpTime 1.6 (19.10.93)
- ;
- ; Written 12. September 1993 by J.Matern
- ; This file is part of the 'UpTime'-package © by Jürgen Matern.
- ; The package may be redistributed under limitations discribed
- ; in the file 'UpTime.doc' which should have come with this
- ; distribution. Read this file for more information!
- ;
- ; Last changed: 19. October 1993
- ;
-
- failat 21
-
- path install add
- path scripts add
- type Install/UpTime.txt
-
- echo " Start installation-script (y/n)? " noline
- set > nil: yesno ?
- if $yesno not eq y
- skip abort
- endif
-
- echo "*N Please enter the directory, where the UpTime-package shall keep it's files."
- echo " If it doesn't exist it will be created: " noline
-
- set > nil: dest ?
- if $dest eq ""
- skip abort
- endif
- if $dest eq "*$dest"
- skip abort
- endif
-
- echo "*N Checking destination directory ..."
-
- CheckDir "$dest" ask
- if val $retcode eq 5
- skip abort
- endif
-
- set dest `AddSlash "$dest"`
- set subdir scripts
- CheckDir "$dest$subdir"
- if val $retcode eq 5
- skip abort
- endif
-
- set date `date`
- set year `ExtractYear $date`
- unset date
-
- set defup UpTime.
- echo "*N Please enter the UpTimeBaseName. The package will create a full filename"
- echo " with path and suffix (actual year). If you enter 'UpTime' the resulting"
- echo " filename will be: '$dest$defup$year'. In this file"
- echo " you will find the times your computer was working, sorted by day."
- echo "*N Enter UpTimeBaseName now: " noline
-
- set > nil: upbase ?
- if $upbase eq ""
- skip abort
- endif
- if $upbase eq "*$upbase"
- skip abort
- endif
-
- set deflog LogFile.
- echo "*N Please enter the LogBaseName. The package will create a full filename"
- echo " with path and suffix (actual year). If you enter 'LogFile' the resulting"
- echo " filename will be: '$dest$deflog$year'. In this file"
- echo " you will find a note every time your computer booted."
- echo "*N Enter LogBaseName now: " noline
-
- set > nil: logbase ?
- if $logbase eq ""
- skip abort
- endif
- if $logbase eq "*$logbase"
- skip abort
- endif
-
- set defonoff OnOff.
- echo "*N Please enter the OnOffBaseName. The package will create a full filename"
- echo " with path and suffix (actual year). If you enter 'OnOff' the resulting"
- echo " filename will be: '$dest$defonoff$year'. In this file you"
- echo " will find a note when you switched your computer on, when you turned it"
- echo " off, and how many resets you had inbetween."
- echo "*N Enter OnOffBaseName now: " noline
-
- set > nil: onoffbase ?
- if $onoffbase eq ""
- skip abort
- endif
- if $onoffbase eq "*$onoffbase"
- skip abort
- endif
-
- echo "*N Please enter the translation of 'yesterday', if your system is localized,"
- echo " otherwise enter 'yesterday': " noline
-
- set > nil: yesterday ?
- if $yesterday eq ""
- skip abort
- endif
- if $yesterday eq "*$yesterday"
- skip abort
- endif
-
- echo "*N Please enter the translation of 'tomorrow', if your system is localized,"
- echo " otherwise enter 'tomorrow': " noline
-
- set > nil: tomorrow ?
- if $tomorrow eq ""
- skip abort
- endif
- if $tomorrow eq "*$tomorrow"
- skip abort
- endif
-
- echo "*N Setting up the UpTime-environment..."
-
- CheckDir ENV:UpTime
- if val $retcode eq 5
- skip abort
- endif
-
- CheckDir ENVARC:UpTime
- if val $retcode eq 5
- skip abort
- endif
-
- setenv UpTime/yesterday $yesterday
- setenv UpTime/tomorrow $tomorrow
- setenv UpTime/UpBaseName "$dest$upbase"
- setenv UpTime/LogBaseName "$dest$logbase"
- setenv UpTime/OnOffBaseName "$dest$onoffbase"
- copy ENV:UpTime/yesterday ENVARC:UpTime/yesterday
- copy ENV:UpTime/tomorrow ENVARC:UpTime/tomorrow
- copy ENV:UpTime/UpBaseName ENVARC:UpTime/UpBaseName
- copy ENV:UpTime/LogBaseName ENVARC:UpTime/LogBaseName
- copy ENV:UpTime/OnOffBaseName ENVARC:UpTime/OnOffBaseName
-
- echo "*N Creating filenames for logfiles ..."
- NewFileNames
-
- echo "*N Copying scripts to '$dest$subdir' ... *N"
- copy scripts/#? "$dest$subdir" clone
-
- if exists s:user-startup
- echo "*N Copying your file 's:user-startup' to 's:user-startup.backup' ..."
- copy s:user-startup s:user-startup.backup clone
- else
- echo "*N Couldn't find file 's:user-startup', can't continue installation!"
- skip abort
- endif
-
- echo "*N Modifying file 's:user-startup' ..."
- echo >> s:user-startup ";BEGIN UPTIME"
- echo >> s:user-startup " assign S: *"$dest$subdir*" add"
-
- search > nil: s:startup-sequence "#?resident#? execute #?execute#?" pattern
- if warn
- echo >> s:user-startup " resident > nil: execute c:execute pure"
- else
- search > Pipe:UpTime_Install_Pipe s:startup-sequence "#?resident#? execute #?remove" pattern
- if not warn
- echo "*N If you want to speed up execution of your scripts then remove"
- echo " the following line in the file 's:startup-sequence':"
- type Pipe:UpTime_Install_Pipe
- echo " ^ ^"
- echo " | |"
- echo " | +-- The line itself"
- echo " +------ Line number "
- endif
- endif
-
- echo >> s:user-startup " resident > nil: eval c:eval pure"
- echo >> s:user-startup " execute > nil: < nil: S:CheckBootDate"
- echo >> s:user-startup ";END UPTIME"
-
- echo "*N Have you already installed a cron-utility (y/n)? " noline
- set > nil: yesno ?
- if $yesno eq y
- skip cronyes
- endif
- skip incomplete
-
- lab cronyes
- echo "*N Have you installed the CyberCron-utility (y/n)? " noline
- set > nil: yesno ?
- if $yesno eq n
- skip nocybercron
- endif
-
- echo "*N Shall I add the UpTime-CronTab to your personal CronTab-file (y/n)? " noline
- set > nil: yesno ?
- if $yesno eq n
- skip nocybercron
- endif
-
- echo "*N Enter filename (with full path)"
- echo " of your CronTab-file: " noline
- set > nil: crontab ?
-
- if $crontab eq ""
- skip abort
- endif
- if $crontab eq "*$crontab"
- skip abort
- endif
-
- if not exists "$crontab"
- echo "*N Couldn't find your CronTab-file!"
- skip nocybercron
- endif
-
- echo > T:Install_UpTime "$dest$subdir" noline
- join $crontab s/CronTab.part1 T:Install_UpTime s/CronTab.part2 AS T:CronTab
- echo > T:Install_UpTime "$dest$subdir" noline
- join T:CronTab T:Install_UpTime s/CronTab.part3 AS $crontab
- delete > nil: T:CronTab
- delete > nil: T:Install_UpTime
- skip modifyuser
-
- lab nocybercron
- echo "*N Installation incomplete!*N"
- echo " You have to reconfigure your personal cron-environment!"
- echo " Your cron has to run the script '$dest$subdir/IncreaseUpTime'"
- echo " every ten minutes, and the script '$dest$subdir/AtMidNite'"
- echo " every midnight. Also see the CronTab-file of this "
- echo " distribution (in s-subdir) for more information!"
- set incomplete yes
- skip modifyuser
-
- lab incomplete
- echo "*N Installation incomplete!*N"
- echo " You have to configure a cron-environment! Perhaps you try 'CyberCron'"
- echo " (see in the documentation for more information on 'CyberCron')."
- echo " Your cron has to run the script '$dest$subdir/IncreaseUpTime'"
- echo " every ten minutes, and the script '$dest$subdir/AtMidNite'"
- echo " every midnight. Also see the CronTab-file of this "
- echo " distribution (in s-subdir) for more information!"
- set incomplete yes
- skip modifyuser
-
- lab abort
- echo "*N Installation aborted.*N"
- set incomplete yes
- skip modifyuser
-
- lab modifyuser
- if $incomplete not eq yes
- echo "*N Installation complete. Reboot your system!"
- endif
-
- path install remove
- path scripts remove
- echo "*N Press <RETURN> to quit!" noline
- set > nil: dummy ?
-